<style type="text/css">
  
</style>
<div class="content">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>修改密码</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane"  lay-filter="forgetPasswordSetPassword">
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="password" required lay-verify="required" placeholder="请输入新密码"
                            class="layui-input">
                    </div>
                </div>
            
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="password_again" required lay-verify="required" placeholder="请再次输入新密码"
                            class="layui-input">
                    </div>
                </div>
            
                <div class="layui-form-item">
                    <a class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" id='submit-update'>提交</a>
                </div>
            
            </form>
        </div>
    </fieldset>
    
</div>

        

<script>
    layui.use(['form', 'layer','jquery','laytpl'], function() {
        var form = layui.form;
        var $ = layui.jquery;
        app.base.setTitle('修改账号密码');
        var code = app.parseUrl().params.code
        app.base.ajaxGet("/api/profile/auth/getUpdatePasswordInfo/" + code, function (data) {

        }, function (msg) {
            layer.alert(msg + "，请重新申请")
            $(".content").hide()
        })
        // 提交
        $("#submit-update").click(function () {
            var password = $('#password').val()
            if($('#password_again').val()!= password){
                layer.msg("两次密码输入不一致")
                return
            }
            if (password == "") {
                layer.msg("请输入密码")
                return
            }
            app.base.ajaxPost("/api/profile/auth/updatePasswordConfirm/" + code, { password: password }, function () {
                layer.alert("密码修改成功")
            }, function (msg) {
                layer.msg("修改失败," + msg)
            })
        })
    });
</script>
